home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Precision Software Appli…tions Silver Collection 1
/
Precision Software Applications Silver Collection Volume One (PSM) (1993).iso
/
windows
/
games
/
tif2win.exe
/
MSBIT.DOC
< prev
next >
Wrap
Text File
|
1988-01-15
|
6KB
|
125 lines
file: MSBIT.DOC
by: W.J.Hinkle
rev: 15 Jan 1988
Lotus Manuscript Bitmapped File Formats
---------------------------------------
This document details the format of the bitmapped graphics files used by
the Lotus Manuscript technical word processing program. These are the BIT
and RLE files than are used to include raster-type images in MS documents.
Note that vector-type images are best translated into PIC files (as used also
by Lotus 1-2-3). As shipped, MS V1.0 only provides translation for scanned
images from Datacopy 720 and MicroTek 300 scanner files (IMG files).
(Supposedly either normal or compressed IMG files can be translated, but I've
been unable to get compressed MicroTek files to translate without "Divide
Overflow".) In order to get any other kind of bit-mapped graphics file, say
a BASIC BLOAD screen image file, into a Manuscript document, it must be
translated into a BIT or RLE file.
Perhaps needless to say, Lotus will not, at this writing, divulge the format
of the BIT and RLE files. Therefore the format was extracted by file snooping
with DEBUG, and experimentation. So this is not gospel!
As suggested above, there are two MS formats used for bit-mapped graphics,
which are differentiated by their filename extentions: either BIT or RLE.
Either of these two file formats can be used to hold the same image, but
RLE files are smaller (as they are Run Length Encoded, hence compressed).
The formats of both the BIT and RLE files are organized as follows:
<header>,<scan line>,<scan line>...
The BIT header consists of 9 bytes of binary information as follows:
<hex 42, the ASCII letter 'B'>
<16-bit word, horizontal resolution in pixels per inch>
<16-bit word, vertical resolution in lines per inch>
<16-bit word, number of horizontal lines in image>
<16-bit word, number of bytes required per line (8 pixels per byte)>
Note that the RLE header format is exactly the same, except that it starts
with <hex 52, the ASCII letter 'R'> instead. All of the 16-bit words are
stored Intel-wise: low byte, then high byte. Note that, for a given image,
final word is the same for either BIT and RLE files.
Scan lines immediately follow the header, starting from the top of the image
and working down without interlace. Scan lines consist entirely of pixel
data encoded into a byte stream, the format of which differs between BIT and
RLE files. There is no additional header data or alignment spacing in the
file. Since the RLE scan line information can be expanded into BIT format,
the BIT format is explained first.
Each BIT file scan line consists of a byte stream encoding pixels from left
to right in the image. Within each byte, the most significant bit (bit 7)
is the leftmost in the scan line. An "on" pixel is represented by a "1" and
an "off" pixel by a "0" bit. In other words, the scan line data is a natural
binary representation of the scan line in the image.
In an RLE file, the same scan line information is encoded into (typically)
fewer bytes. Each sequence of up to 128 identical pixels is encoded into a
single byte, where the sense of bit 7 gives the state of the pixel ("on"="1",
"off="0") and the lower 7 bits give a run length 1-127, with 0 representing
128 pixels. Generally this encoding yields a much smaller image file, unless
there are numerous very short pixel runs.
Note that, in translating a screen image, you may want to reverse the sense
of the pixels, as images that look OK on a screen will often look like they
are color-reversed (negative) on the printed page!
Basic BLOAD Files
-----------------
It is a very straightforward translation from Basic BLOAD screen graphic files
to BIT files (or RLE files). The simplest are those from a single-color
CGA or EGA screen. A BLOAD file is very similar to a BIT file in that there
is a header and then unaligned scan line data. The BLOAD header is consists
of 7 bytes of binary information:
<hex FD>
<16-bit word, giving the screen memory segment; e.g. B800, A000, etc.>
<16-bit word, always 0000 for a screen image>
<16-bit word, giving the total number of bytes encoding pixels in the image>
The scan lines follow without further header information or alignment, except
for interlace. The scan lines are represented just as in the BIT file: left
to right, bit 7 leftmost, with the same pixel sense. It is up to the
translator to determine, perhaps from the header, what the aspect ratio and
interlace of the image are.
A CGA header (in hexadecimal) may be:
<FD>,<00>,<B8>,<00>,<00>,<80>,<3E>
meaning a BLOAD file from screen memory at B800:0000 with 16000 bytes. Note
that CGA graphic screens have a x2 interlace, which is reflected in the BLOAD
file. The entire screen buffer is 16384 bytes, with all of the 100 even scan
lines first, a gap, and then all of the 100 odd scan lines. Therefore a CGA
BLOAD file consists of 16384+7 = 16391 bytes. The even scan lines are listed
after the header, and the odd scan lines with an additional 8192 byte offset.
Each scan line consists of 640 pixels, or 80 bytes. The translator must
interlace the lines into the BIT file.
The EGA header (in hexadecimal) is:
<FD>,<00>,<A0>,<00>,<00>,<60>,<6D>
meaning a BLOAD file from screen memory at A000:0000 with 28000 bytes. Note
that EGA graphic screens of this sort have no interlace. The entire EGA BLOAD
file consists of 28000+7 = 28007 bytes. The 350 scan lines are listed
consecutively after the header, each consisting of 640 pixels, or 80 bytes.
Other BLOAD files may be created from other types of video system's screen
buffers. These will differ in segment address, number of bytes, number of
lines and pixels per line, and interlace. Good luck!
Note that the ShareWare program "Optiks" (OK.EXE), available on many bulletin
boards, can translate many graphics files, such as PC-Paint, to Basic BLOAD
files. These can then be translated into BIT or RLE files. The BIT2BAS.EXE
program, for example, can translate CGA or EGA BLOAD (BAS) screen image files
to BIT files. Also available for Manuscript users is the ADI2PIC.EXE program,
which translates AutoCad ADI plot files to Lotus PIC files, or acts as a
loadable AutoCad plotter driver that creates PIC files directly. These PIC
files can also be used directly by Manuscript and generally are smaller and
more precise than an equivalent raster, or bitmapped, image.